var t = getApp();

Page({
    data: {
        formId: "",
        email: "",
        id: "",
        list: [],
        condition: !0,
        cond: !0
    },
    onLoad: function(e) {
        e.web && this.setData({
            cond: !1,
            web: e.web
        }), e.web && 1 != e.web || t.WxLogin(), this.loadData(1), t.GetUrl();
    },
    formSubmit: function(e) {
        var o = this, a = (e.detail.value.name, e.detail.value.mobile), i = (e.detail.value.company, 
        e.detail.value.position, e.detail.value.way), n = e.detail.value.city, l = e.detail.value.content;
        a && i ? (wx.showToast({
            title: "正在提交表单",
            icon: "loading",
            duration: 12e3
        }), wx.request({
            url: t.url + "addon/Htkmsg/Htkmsg/addMsg",
            data: {
                name: e.detail.value.name,
                mobile: e.detail.value.mobile,
                company: e.detail.value.company,
                position: e.detail.value.position,
                way: e.detail.value.way,
                city: n,
                content: l,
                comefrom: "WX",
                catname: "日常预约"
            },
            method: "POST",
            header: {
                "content-type": "application/x-www-form-urlencoded",
                Cookie: "PHPSESSID=" + wx.getStorageSync("PHPSESSID")
            },
            success: function(t) {
                wx.hideToast(), o.setData({
                    condition: !1
                }), wx.showToast({
                    title: "表单提交成功",
                    icon: "success",
                    duration: 2200
                });
            },
            fail: function(t) {
                wx.hideToast(), wx.showToast({
                    title: "无法连接网络",
                    icon: "loading",
                    duration: 2e3
                });
            }
        })) : (a || wx.showToast({
            title: "未填写手机电话",
            icon: "loading",
            duration: 2e3
        }), i || wx.showToast({
            title: "未选择培训方式",
            icon: "loading",
            duration: 2e3
        }));
    },
    ToWebview: function() {
        var t = this.data.web;
        1 == t && wx.switchTab({
            url: "../Draft/Draft"
        }), 2 == t && wx.redirectTo({
            url: "../InvoiceCter/InvoiceCter"
        });
    },
    backtoCover: function() {
        wx.switchTab({
            url: "../Draft/Draft"
        });
    },
    loadData: function(e) {
        var o = this;
        wx.request({
            url: t.url + "addon/Noticebd/Noticebd/getnoticeDetail",
            data: {
                id: e
            },
            method: "GET",
            header: {
                "Content-Type": "application/json",
                Cookie: "PHPSESSID=" + wx.getStorageSync("PHPSESSID")
            },
            success: function(t) {
                console.log(t), o.setData({
                    notice: t.data
                });
            },
            fail: function(t) {
                o.setData({
                    "notice.title": "培训预约表",
                    "notice.content": "填写本表后，我们将根据您选择的培训方式，及时与您沟通交流有关培训的具体事宜，无论是您选择参加培训班，还是上门为您的企业培训，我们都将竭诚服务，让您学有所得，谢谢您的参与。"
                }), wx.showToast({
                    title: "网络连接异常，请检查你的手机网络。",
                    icon: "loading",
                    duration: 3e3
                });
            }
        });
    },
    callus: function() {
        wx.makePhoneCall({
            phoneNumber: wx.getStorageSync("CsTelphone")
        });
    },
    onShareAppMessage: function(t) {
        return "button" === t.from && console.log(t), {
            title: "六维合同课",
            path: "/pages/reglist/reglist?web=1",
            success: function(t) {},
            fail: function(t) {}
        };
    }
});